<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>

    /* 1.//输出1-10岁
    for (let i = 1; i <= 10; i++) {
      document.write(`我今年${i}岁<br>`)
    } */

    /* 2.//利用for循环求1-100之间的偶数和
    let sum = 0
    for (let i = 0; i <= 100; i++) {
      if (i % 2 === 0) {
        sum += i
      }
    }
    document.write(`1-100之间的偶数和为${sum}`) */

    /* //3.页面中打印5个小星星
    for (let i = 1; i <= 5; i++) {
      document.write('*')
    } */

    /* //4.打印数组/遍历数组
    let arr = ['刘德华', '张学友', '黎明', '郭富城', '蔡徐坤']
    //for (let i = 0; i < arr.length ; i++)
    for (let i = 0; i <= arr.length - 1; i++) {
      console.log(arr[i]);
    }

    let arr1 = []
    console.log(arr1)
    console.log(arr1[0]) */
  </script>
</body>

</html>